Skip to content

Enable ruff pyupgrade (UP) lint rules#4940

Open
toroleapinc wants to merge 1 commit intoopen-telemetry:mainfrom
toroleapinc:feat/issue-4227-ruff-UP-rule
Open

Enable ruff pyupgrade (UP) lint rules#4940
toroleapinc wants to merge 1 commit intoopen-telemetry:mainfrom
toroleapinc:feat/issue-4227-ruff-UP-rule

Conversation

@toroleapinc
Copy link

Summary

Enable a subset of safe pyupgrade (UP) ruff rules that are compatible with the Python 3.8 target version:

  • UP011: Remove unnecessary parentheses from @lru_cache()
  • UP015: Remove redundant open() mode arguments
  • UP032: Replace .format() calls with f-strings
  • UP034: Remove extraneous parentheses
  • UP037: Remove unnecessary quoted annotations (in files with from __future__ import annotations)

All 42 violations were auto-fixed by ruff check --fix.

Not included (unsafe for py38 target): UP006, UP007, UP031, UP045 which require Python 3.9+/3.10+ syntax.

Part of #4227

@toroleapinc toroleapinc requested a review from a team as a code owner February 27, 2026 16:09
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 27, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: toroleapinc / name: edvatar (a79066b)

@xrmx xrmx moved this to Easy to review / merge / close in Python PR digest Mar 2, 2026
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 2, 2026
@xrmx
Copy link
Contributor

xrmx commented Mar 2, 2026

@toroleapinc thanks for the PR we can accept contributions only if you sign the CLA

Enable a subset of pyupgrade rules that are safe for the Python 3.8
target version:
- UP011: lru-cache-without-parameters
- UP015: redundant-open-modes
- UP032: f-string (replaces .format() calls)
- UP034: extraneous-parentheses
- UP037: quoted-annotation (removes unnecessary string quotes)

All 42 violations were auto-fixed by ruff.

Part of open-telemetry#4227

Signed-off-by: edvatar <88481784+toroleapinc@users.noreply.github.com>
@toroleapinc toroleapinc force-pushed the feat/issue-4227-ruff-UP-rule branch from 40895e2 to a79066b Compare March 3, 2026 05:33
Copy link
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

Status: Easy to review / merge / close

Development

Successfully merging this pull request may close these issues.

3 participants